package com.geek.novel.utils

import android.text.TextUtils
import android.widget.Toast
import com.geek.novel.bo.AppContext

class ToastUtils {
	
	companion object{
	
		private var toast: Toast? = null

		fun toastLong(text: String?){
			toast(text, Toast.LENGTH_LONG)
		}

		fun toast(text: String?, length: Int=Toast.LENGTH_SHORT){
			if(TextUtils.isEmpty(text)){
				return
			}
			if(toast != null){
				toast!!.cancel()
			}
			toast = Toast.makeText(AppContext.getContext(), text, Toast.LENGTH_SHORT)
			toast!!.show()
		}

	}
	
}